<script setup lang="ts">
import { Switch } from '@element-plus/icons-vue'
import useLocale from '@/hooks/useLocale'
const { changeLocale, currentLocale, LOCALE_OPTIONS } = useLocale()
</script>

<template>
  <div>
    <el-dropdown trigger="click" @command="changeLocale">
      <el-button class="my-icon-button" circle :icon="Switch"></el-button>
      <template #dropdown>
        <el-dropdown-menu>
          <template v-for="item in LOCALE_OPTIONS" :key="item.value">
            <el-dropdown-item
              :disabled="currentLocale && currentLocale === item.value"
              :command="item.value"
              >{{ item.label }}</el-dropdown-item
            >
          </template>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<style lang="scss" scoped></style>
